//
//  XMView.m
//  MyDemos
//
//  Created by iMac on 2018/3/16.
//  Copyright © 2018年 iMac. All rights reserved.
//

#import "XMView.h"



@interface XMView()



@end

@implementation XMView
- (instancetype)init {
    self = [super init];
    if (self) {
        UIButton *btn = Button().sFrame(CGRectMake(0, 0, 44, 44)).sBGColor([UIColor redColor]);
        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        
        UIButton *btn2 = Button().sFrame(CGRectMake(56, 0, 44, 44)).sBGColor([UIColor blueColor]);
        [btn2 addTarget:self action:@selector(btn2Click:) forControlEvents:UIControlEventTouchUpInside];
        
        self.aSubView(btn).aSubView(btn2);
        
    }
    return self;
}

- (void)btnClick:(UIButton *)sender {
    sender.selected = !sender.selected;
    NSLog(@"btn click");
    if (self.subject) {
        [self.subject sendNext:sender];
    }
}
- (void)btn2Click:(UIButton *)sender {}

@end
